package hibernate_basic.Zexercise.topic01;

import hibernate_basic.Persistence.comment_persitence.Person;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;

/**
 * @author Administrator
 * @create 2019-01-01 10:12
 * @desc 修改员工信息
 **/
public class Updata {

    public static void main(String args[]){
        Configuration config=new Configuration();
        config.configure("hibernate_basic/config/config_comment/hibernate.cfg.xml");

        SessionFactory factory=config.buildSessionFactory();
        Session session=factory.openSession();

        Transaction tran=session.beginTransaction();

        Person person=session.get(Person.class,15);
        person.setName("林依晨");
        person.setAge(100);

        tran.commit();

        session.close();

    }

}
